color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?

This function is not working (at least in 9.5.0.0) if the attribute name refers to a multivalued attribute (actually the attribute of the column - of course).

Does someone know about a workaround or a new DXL (undocumented of course as backgroundColor(Column s, string attrName) ;-) ) ?

Of course I tried foregroundColor or textColor without success.

Thanks for your help.


jaracic - Wed Sep 17 08:03:39 EDT 2014

Re: color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?
jaracic - Wed Sep 17 10:06:26 EDT 2014

Actually the function works.

The problem is (only for a multivalued attribute)

attribute(c, attrName)

string theColor = color(c)

theColor is empty

The workaround is to set the theColor variable before doing the attribute(c, attrName)

... I love DXL !

Re: color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?
llandale - Wed Sep 17 15:30:25 EDT 2014

jaracic - Wed Sep 17 10:06:26 EDT 2014

Actually the function works.

The problem is (only for a multivalued attribute)

attribute(c, attrName)

string theColor = color(c)

theColor is empty

The workaround is to set the theColor variable before doing the attribute(c, attrName)

... I love DXL !

Huh?  There is no such command:

  • string theColor = color(c, attrName)

Either:

  • string theColor = color(c)    // get the name of the attribute controlling the color
  • void color(c, attrName)    // set the color based on that enumerated attribute.

To actually get Colors, you need to get the AttrType handle and loop through the enumerations.

In any event I imagine you would have some trouble choosing which color.  If the base enumerations are 1(blue), 2(red), and 3(green) and this object has multi-selected 1 and 3; which color do you want displayed?

-Louie

Re: color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?
jaracic - Wed Sep 17 17:24:56 EDT 2014

llandale - Wed Sep 17 15:30:25 EDT 2014

Huh?  There is no such command:

  • string theColor = color(c, attrName)

Either:

  • string theColor = color(c)    // get the name of the attribute controlling the color
  • void color(c, attrName)    // set the color based on that enumerated attribute.

To actually get Colors, you need to get the AttrType handle and loop through the enumerations.

In any event I imagine you would have some trouble choosing which color.  If the base enumerations are 1(blue), 2(red), and 3(green) and this object has multi-selected 1 and 3; which color do you want displayed?

-Louie

I correct my post.

Joseph.

Re: color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?
7XUT_Antonio_Norkus - Thu Sep 18 06:20:15 EDT 2014

My solution is to create a DXL attribute that maps a multi-value attribute to a single-value attribute (where both attributes are based on same Enumerated type). You can then use the single-value DXL attribute to colour a column.

e.g.

CASE1 = RED

CASE2 = AMBER

CASE3 = GREEN

In this example, the single-value attribute represents the worst case that is present within the multi-value attribute. The single-value attribute DXL is:

if (isMember((obj."MultiAttr"), "CASE1") obj.attrDXLName = "CASE1"

else if (isMember((obj."MultiAttr"), "CASE2") obj.attrDXLName = "CASE2"

else if (isMember((obj."MultiAttr"), "CASE3") obj.attrDXLName = "CASE3"

 

 

 

Re: color(Column c, string attrName) does not works with mutlivalued attribute, any workaround?
Wolfgang Uhr - Thu Sep 18 06:59:40 EDT 2014

7XUT_Antonio_Norkus - Thu Sep 18 06:20:15 EDT 2014

My solution is to create a DXL attribute that maps a multi-value attribute to a single-value attribute (where both attributes are based on same Enumerated type). You can then use the single-value DXL attribute to colour a column.

e.g.

CASE1 = RED

CASE2 = AMBER

CASE3 = GREEN

In this example, the single-value attribute represents the worst case that is present within the multi-value attribute. The single-value attribute DXL is:

if (isMember((obj."MultiAttr"), "CASE1") obj.attrDXLName = "CASE1"

else if (isMember((obj."MultiAttr"), "CASE2") obj.attrDXLName = "CASE2"

else if (isMember((obj."MultiAttr"), "CASE3") obj.attrDXLName = "CASE3"

 

 

 

jaracic allread has found the answer!